package com.leiyuee.designpattern.adapter.service;

import cn.hutool.extra.spring.SpringUtil;
import com.leiyuee.designpattern.adapter.adapter.ChargerAdapter;
import com.leiyuee.designpattern.adapter.adapter.IndiaChargerAdapter;
import com.leiyuee.designpattern.adapter.params.NationParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author : Yu_Lei
 * @create 2024/5/8
 */
@Service
public class AdapterServiceImpl implements AdapterService {

    @Autowired
    private IndiaChargerAdapter indiaChargerAdapter1;
    @Override
    public String outputVoltage(NationParam param) {
        ChargerAdapter chargerAdapter = SpringUtil.getBean(param.getNationType(), ChargerAdapter.class);
        indiaChargerAdapter1.outputVoltage();
        return chargerAdapter.outputVoltage();
    }
}
